// pages/list/list.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    keyword: '',
    no: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this;
    this.setData({
      keyword: options.keyword
    })

    wx.request({
      url: 'https://xcxu.we-fs.com/index.php/Api/goods/goodsInfo2?admin_id[v]=' + app.globalData.admin_id + '&cat_list[v]=67115&cat_list[e]=like&goods_name[v]=' + options.keyword + '&goods_name[e]=like',
      success: function(res) {
        console.log(res)
        if (res.data.length > 0) {
          that.setData({
            items: res.data,
            no: false
          })
        } else {
          that.setData({
            items: [],
            no: true
          })
        }
      }
    })
  },
  goodsClick(e){
    wx.navigateTo({
      url: '../../pages/goods/goods?id=' + e.currentTarget.dataset.id,
    })
  }

})